
import CONST from './collision-const';

/**
 * 碰撞世界配置
 */
export default class CollisionWorldConfig{
    constructor(){
        this._init();
    }

    //------------------------------对外属性----------------------------------------

    /**
     * 设置空间分割检测方法
     * @param method {string} jPhysicsConst.SPATIAL_PARTITIONING_DBVT:动态树,jPhysicsConst.SPATIAL_PARTITIONING_SAP:轴扫掠
     */
    set spatialPartitioningMethod(method){
        this._spatialPartitioningMethod=method;
    }

    /**
     * 获取空间分割检测方法
     * @returns {string|string}
     */
    get spatialPartitioningMethod(){
        return this._spatialPartitioningMethod;
    }

    /**
     * 是否在形状中记录碰撞的对象
     * @returns {*|boolean}
     */
    get recordContactTarget(){
        return this._recordContactTarget;
    }

    /**
     * 是否在形状中记录碰撞的对象
     * @param bol {boolean}
     */
    set recordContactTarget(bol){
        this._recordContactTarget=bol;
    }

    //----------------------------------私有方法---------------------------------------

    /**
     * 初始化
     * @private
     */
    _init(){
        this._initVariable();
    }

    /**
     * 初始化变量
     * @private
     */
    _initVariable(){
        this._spatialPartitioningMethod=CONST.SPATIAL_PARTITIONING_DBVT;
        this._recordContactTarget=true;
    }
}